import request from '/@/utils/request';


import qs from 'qs'

export function mongoGridfsApi() {
  return {

    /*通过传入参数pageType控制权限，将来可能会查询共享文件的情况，暂时先不做*/
    queryGridFs: function (pageType: any, page: any, pageSize: any, params: any) {
      return request({
        url: 'COMMON-SERVICE/' + pageType + '/mongo/gridfs/list/' + page + "/" + pageSize,
        method: 'post',
        data: params
      })
    }
    ,
    deleteFiles: function (pageType: any, files: any) {
      return request({
        url: 'COMMON-SERVICE/' + pageType + '/mongo/gridfs/delete',
        method: 'post',
        data: files
      })
    }
    ,
    downloadFileByAdmin: function (pageType: any, _id: String) {
      return request({
        url: 'COMMON-SERVICE/' + pageType + '/mongo/gridfs/download',
        method: 'get',
        responseType: 'blob',
        params: { _id: _id }
      })
    }

    ,
    showFileByAdmin: function (pageType: String, _id: String) {

      return request({
        url: 'COMMON-SERVICE/' + pageType + '/mongo/gridfs/showFile',
        method: 'get',
        responseType: 'blob',
        params: { _id: _id }
      })
    }
  }
}
